package ar.edu.unlam.tpfinal;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;

@SuppressWarnings("serial")
public class BaseException extends RuntimeException {

	private Logger exceptionLogger = LoggerFactory.getLogger(BaseException.class);

	public BaseException(String message) {
		super(message);
	}
	
	public BaseException(String message, String log) {
		super(message);
		exceptionLogger.error(log);
	}

	public BaseException(String message, Throwable cause) {
		super(message, cause);
	}
	
	public BaseException(String message, Throwable cause, String log) {
		super(message, cause);
		exceptionLogger.error(log, cause);
	}

	public BaseException(String message, String log, Level logLevel) {
		super(message);

		if (Level.ERROR.equals(logLevel)) {
			exceptionLogger.error(log);
		} else if (Level.INFO.equals(logLevel)) {
			exceptionLogger.info(log);
		} else if (Level.DEBUG.equals(logLevel)) {
			exceptionLogger.debug(log);
		} else if (Level.WARN.equals(logLevel)) {
			exceptionLogger.warn(log);
		}
	}
}
